import pygame

class ResourceManager(dict):
	def __init__(self, filename=None):
		if filename:
			self._load_lst(filename)
			
	def _load_lst(self, filename):
		file = open(filename, 'r')
		for l in file:
			if l[0] == '#':
				pass
			else:
				file = l.strip().split(':')
				temp_image = pygame.image.load(file[1]).convert()
				temp_image.set_colorkey((255,0,255))
				self[file[0]] = temp_image
			
	def get_image(self, key):
		return self[key]